Previous Book Contents Book Index Next

Inside Macintosh: Overview /
Chapter 3 - Resources


Using Standard Resources

In general, you'll need to create resources describing the standard user interface elements used by your application, including

For standard user interface elements, the Macintosh Toolbox provides special routines you can use to open the appropriate resources. For instance, you can call the Dialog Manager function GetNewDialog to read a dialog box resource (of type 'DLOG') and the corresponding item list (of type 'DITL') from your application's resource fork.

myDialog := GetNewDialog(myKind, myPointer, WindowPtr(-1));
Similarly, you can call the Window Manager routine GetNewWindow to open a window description resource (of type 'WIND'). Internally, these routines call Resource Manager routines such as GetResource to read the resource data from the resource file.

Some Toolbox routines are simply loosely disguised Resource Manager calls. For example, the code shown on page 56 which uses GetPattern to open four available emptiness patterns could be replaced by this functionally equivalent code:

FOR count := 1 TO 4 DO
   gEmptyPats[count] := GetResource('PAT ', kEmptyID + (count - 1));
Most Resource Manager routines that open resources return a handle to the specified resource data. You can pass that handle to other Resource Manager routines, or doubly dereference it to get at the resource data.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
9 JUL 1996